package com.zj.joke.db;

/**
 * Created by zhangjian on 13-12-6.
 */

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;

import java.util.List;

@Table(name = "DBLikeItem")
public class DBLikeItem extends Model {

	@Column(name = "text")
	public String text;

	@Column(name = "title")
	public String title;

	@Column(name = "url")
	public String url;

	@Column(name = "save_time")
	public long save_time;

	public static int getDBLikeItemSize() {
		return new Select().from(DBLikeItem.class).execute().size();
	}

	public static List<DBLikeItem> getDBLikeItems() {
		return new Select().from(DBLikeItem.class).execute();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof DBLikeItem) {
			DBLikeItem likeItem = (DBLikeItem) obj;
			return title.equals(likeItem.title);
		}
		return false;
	}
}